package com.mxt.dao;

import com.mxt.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserDao {
    @Select("select * from user")
    List<User> queryAll();

    @Insert("insert into user(username,password,sex,name)" +
            "values(#{username},#{password},#{sex},#{name})")
    void save(User user);

    @Select("select * from user where id= #{id}")
    User findById(Integer id);

    @Update("update user set username=#{username},password=#{password},name=#{name},sex=#{sex} where id = #{id}")
    void update(User user);

    @Delete("delete from user where id = #{id}")
    void delete(Integer id);
}
